package model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the candidature database table.
 * 
 */
@Entity
@NamedQuery(name="Candidature.findAll", query="SELECT c FROM Candidature c")
public class Candidature implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int idCandidature;

	@Temporal(TemporalType.DATE)
	private Date dateReception;

	@Temporal(TemporalType.DATE)
	private Date dateReponse;

	private String motif;

	private String statut;

	//bi-directional many-to-one association to Candidat
	@ManyToOne
	@JoinColumn(name="idCandidat")
	private Candidat candidat;

	//bi-directional many-to-one association to Formationannee
	@ManyToOne
	@JoinColumn(name="idFormationAnnee")
	private Formationannee formationannee;

	//bi-directional many-to-one association to Cursus
	@OneToMany(mappedBy="candidature")
	private List<Cursus> cursuses;

	public Candidature() {
	}

	public int getIdCandidature() {
		return this.idCandidature;
	}

	public void setIdCandidature(int idCandidature) {
		this.idCandidature = idCandidature;
	}

	public Date getDateReception() {
		return this.dateReception;
	}

	public void setDateReception(Date dateReception) {
		this.dateReception = dateReception;
	}

	public Date getDateReponse() {
		return this.dateReponse;
	}

	public void setDateReponse(Date dateReponse) {
		this.dateReponse = dateReponse;
	}

	public String getMotif() {
		return this.motif;
	}

	public void setMotif(String motif) {
		this.motif = motif;
	}

	public String getStatut() {
		return this.statut;
	}

	public void setStatut(String statut) {
		this.statut = statut;
	}

	public Candidat getCandidat() {
		return this.candidat;
	}

	public void setCandidat(Candidat candidat) {
		this.candidat = candidat;
	}

	public Formationannee getFormationannee() {
		return this.formationannee;
	}

	public void setFormationannee(Formationannee formationannee) {
		this.formationannee = formationannee;
	}

	public List<Cursus> getCursuses() {
		return this.cursuses;
	}

	public void setCursuses(List<Cursus> cursuses) {
		this.cursuses = cursuses;
	}

	public Cursus addCursus(Cursus cursus) {
		getCursuses().add(cursus);
		cursus.setCandidature(this);

		return cursus;
	}

	public Cursus removeCursus(Cursus cursus) {
		getCursuses().remove(cursus);
		cursus.setCandidature(null);

		return cursus;
	}

}